home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-04
/
422mods.zip
/
TOP10.422
< prev
next >
Wrap
Text File
|
1993-02-23
|
9KB
|
281 lines
//TOP10 Mod for WWIV v4.22 . . .
Dr. Dre #1 @1 7-=1Top Administrator7=-0
Mon Feb 22 07:03:20 1993
┌────────────────────────────────────────────────────────────────────────────┐
│ Mod Name: Top10 .MOD Mod Authors: Sledgehammer 1@4654 WWIVnet AC │
│ Difficulty: Easy Date: January 21,1993 │
│ WWIV Version: 4.22 - but should work on just about any... once you find │
│ where it's supposed to go in bbs.c │
│ Files Affected: bbs.c │
│ Description: This mod will print out top 10 leachers, posters, uploaders │
│ and also the users who have spent the most time online. │
└────────────────────────────────────────────────────────────────────────────┘
Discalimer: If you do regular BACK UPS you won't ever have problems. But if
do email me and I will help you the best I can. The mod works
perfect with my bbs...
STEP 1:
Open up BBS.c and add the followong void just before void mainmenu.
void top_ten_lists()
{
userrec u;
int i,i1,stop,num_users,ok,j;
int low_posts_on_list,
low_logons_on_list,
store_int,
posts_per_user[10],
logons_per_user[10],
flag,
last;
unsigned long up_k_per_user[10],
dn_k_per_user[10],
store_lng;
float timeon_per_user[10],
store_flt;
char s[5][10][31],
ch,
store_chr[31];
for (i = 0; i < 10; i++) {
posts_per_user[i] = 0;
logons_per_user[i] = 0;
up_k_per_user[i] = 0;
dn_k_per_user[i] = 0;
timeon_per_user[i] = 0;
}
num_users = number_userrecs();
npr("%2d Total Users",num_users);
ok = 0;
/* Initialize Variables with Default Values */
for (i = 0; i < 5; i++)
for (i1 = 0; i1 < 10; i1++)
strcpy(s[i][i1], "None");
/* Get the 10 Highest Values From the Userlists */
for( i=1; i<=num_users; i++ )
{
read_user( i, &u );
stop = posts_per_user[0];
j = 0;
for( i1=1; i1<10; i1++ )
if( posts_per_user[i1] < stop )
{
j = i1;
stop = posts_per_user[i1];
}
if( u.msgpost > stop )
{
posts_per_user[j] = u.msgpost;
strcpy( s[0][j], nam(&u, i ) );
}
stop = logons_per_user[0];
j = 0;
for( i1=1; i1<10; i1++ )
if( logons_per_user[i1] < stop )
{
j = i1;
stop = logons_per_user[i1];
}
if( u.logons > stop )
{
logons_per_user[j] = u.logons;
strcpy( s[1][j], nam(&u, i ) );
}
store_lng = up_k_per_user[0];
j = 0;
for( i1=1; i1<10; i1++ )
if( up_k_per_user[i1] < store_lng )
{
j = i1;
store_lng = up_k_per_user[i1];
}
if( u.uk > store_lng )
{
up_k_per_user[j] = u.uk;
strcpy( s[2][j], nam(&u, i ) );
}
store_lng = dn_k_per_user[0];
j = 0;
for( i1=1; i1<10; i1++ )
if( dn_k_per_user[i1] < store_lng )
{
j = i1;
store_lng = dn_k_per_user[i1];
}
if( u.dk > store_lng )
{
dn_k_per_user[j] = u.dk;
strcpy( s[3][j], nam(&u, i ) );
}
store_flt = timeon_per_user[0];
j = 0;
for( i1=1; i1<10; i1++ )
if( timeon_per_user[i1] < store_flt )
{
j = i1;
store_flt = timeon_per_user[i1];
}
if( u.timeon > store_flt )
{
timeon_per_user[j] = u.timeon;
strcpy( s[4][j], nam(&u, i ) );
}
}
/* Fix the Timeon to minutes instead of seconds. */
for( i=0; i < 10; i++ )
timeon_per_user[i] = ( timeon_per_user[i] / 60 );
/*
Sort Data
*/
for( j = 0; j < 10; j++ )
for( i = j+1; i < 10; i++ )
{
if( posts_per_user[i] > posts_per_user[j] )
{
store_int = posts_per_user[i];
posts_per_user[i] = posts_per_user[j];
posts_per_user[j] = store_int;
strcpy(store_chr, s[0][i]);
strcpy(s[0][i], s[0][j]);
strcpy(s[0][j], store_chr);
}
if( logons_per_user[i] > logons_per_user[j] )
{
store_int = logons_per_user[i];
logons_per_user[i] = logons_per_user[j];
logons_per_user[j] = store_int;
strcpy(store_chr, s[1][i]);
strcpy(s[1][i], s[1][j]);
strcpy(s[1][j], store_chr);
}
if( up_k_per_user[i] > up_k_per_user[j] )
{
store_lng = up_k_per_user[i];
up_k_per_user[i] = up_k_per_user[j];
up_k_per_user[j] = store_lng;
strcpy(store_chr, s[2][i]);
strcpy(s[2][i], s[2][j]);
strcpy(s[2][j], store_chr);
}
if( dn_k_per_user[i] > dn_k_per_user[j] )
{
store_lng = dn_k_per_user[i];
dn_k_per_user[i] = dn_k_per_user[j];
dn_k_per_user[j] = store_lng;
strcpy(store_chr, s[3][i]);
strcpy(s[3][i], s[3][j]);
strcpy(s[3][j], store_chr);
}
if( timeon_per_user[i] > timeon_per_user[j] )
{
store_flt = timeon_per_user[i];
timeon_per_user[i] = timeon_per_user[j];
timeon_per_user[j] = store_flt;
strcpy(store_chr, s[4][i]);
strcpy(s[4][i], s[4][j]);
strcpy(s[4][j], store_chr);
}
}
nl();
do {
npr("\r\nTop 10 Lists for %s!\r\n\n",syscfg.systemname);
prt(1,"1) Posts"); nl();
prt(2,"2) Logons"); nl();
prt(3,"3) K Uploaded"); nl();
prt(4,"4) K Downloaded"); nl();
prt(5,"5) Total Time on"); nl();
prt(6,"Q) Quit"); nl();nl();
prt(7,"Which (1-5,Q) ? ");
ch = onek("Q12345");
nl();
switch(ch) {
case 'Q':
ok = 1;
break;
case '1':
prt(3,"Highest number of posts");
nl();nl();
npr("## Posts Name\r\n");
for (i = 0; i < 10; i++)
npr("%2d. %-3d %s\r\n",
i+1,
posts_per_user[i],
s[0][i]);
break;
case '2':
prt(3,"Highest Number of Logons");
nl();nl();
npr("## Logons Name\r\n");
for (i = 0; i < 10; i++)
npr("%2d. %-3d %s\r\n",
i+1,
logons_per_user[i],
s[1][i]);
break;
case '3':
prt(3,"Most K Uploaded (Sledge's BEST)");
nl();nl();
npr("## Up K Name\r\n");
for (i = 0; i < 10; i++)
npr("%2d. %-5ld %s\r\n",
i+1,
up_k_per_user[i],
s[2][i]);
break;
case '4':
prt(3,"Most K LEACHED");
nl();nl();
npr("## Down K Name\r\n");
for (i = 0; i < 10; i++)
npr("%2d. %-5ld %s\r\n",
i+1,
dn_k_per_user[i],
s[3][i]);
break;
case '5':
prt(3,"Most time spent online");
nl();nl();
npr("## Time On Name\r\n");
for (i = 0; i < 10; i++)
npr("%2d. %-6.0f %s\r\n",
i+1,
timeon_per_user[i],
s[4][i]);
break;
}
} while ((!hangup) && (!ok));
}
STEP 2:
Add the following two lines in void mainmenu..
if ((strcmp(s,"UPLOAD")==0) && (actsl>10))
upload_post();
if (strcmp(s,"TOP10")==0) /*add*/
top_ten_lists(); /*add*/
STEP 3:
Add //top10 to your menu and recompile!